package com.ctshk.app.custom.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.AppReq;
import com.ctshk.common.model.PageResponse;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.custom.dto.client.ClientAreaDTO;
import com.ctshk.rpc.custom.dto.client.ClientInquiryDetailDTO;
import com.ctshk.rpc.custom.dto.client.ClientInquiryListDTO;
import com.ctshk.rpc.custom.dto.client.ClientInquiryRequireListDTO;
import com.ctshk.rpc.custom.req.client.ClientInquiryDetailReq;
import com.ctshk.rpc.custom.req.client.ClientInquiryListReq;
import com.ctshk.rpc.custom.req.client.ClientNoticeListDTO;
import com.ctshk.rpc.custom.req.inquiry.InquiryTourInformationReq;
import com.ctshk.rpc.custom.service.ICustomizedTripScheduleInformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 定制旅游用户信息服务项目 前端控制器
 * </p>
 *
 * @author 叶冠峰
 * @since 2021-06-02
 */
@RestController
@Api(value="定制游（C端）", tags="定制游（C端）")
@RequestMapping("/information")
public class CustomizedTripScheduleInformationController extends BaseController {

    @DubboReference
    private ICustomizedTripScheduleInformationService customizedTripScheduleInformation;

    @ApiOperation(value="定制游下单（C端）", notes="定制游下单（C端）")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.ADD, operTitle = "定制游下单（C端）", operDesc = "定制游下单（C端）")
    @PostMapping("/add")
    public Result orderAdd(@RequestBody @Valid InquiryTourInformationReq informationReq,@ApiIgnore AppReq appReq ){
        return customizedTripScheduleInformation.add(informationReq,appReq);
    }

    /*@ApiOperation(value="我的預約咨詢（C端）", notes="我的預約咨詢列表（C端）")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "我的預約咨詢列表（C端）", operDesc = "我的預約咨詢列表（C端）")
    @PostMapping("/list")
    public PageResponse<ClientInquiryListDTO> list(@RequestBody @Valid ClientInquiryListReq req ){
        return customizedTripScheduleInformation.list(req);
    }*/

    @ApiOperation(value="需求詳情（C端）", notes="需求詳情（C端）")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "需求詳情（C端）", operDesc = "需求詳情（C端）")
    @PostMapping("/detail")
    public Result<ClientInquiryDetailDTO> detail(@RequestBody @Valid ClientInquiryDetailReq req ){
        return customizedTripScheduleInformation.detail(req);
    }

    @ApiOperation(value="服务要求列表（C端）", notes="服务要求列表（C端）")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "我的預約咨詢列表（C端）", operDesc = "我的預約咨詢列表（C端）")
    @PostMapping("/require-list")
    public Result<List<ClientInquiryRequireListDTO>> requireList(){
        List<ClientInquiryRequireListDTO> listDTOS = customizedTripScheduleInformation.requireList();
        return Result.success(listDTOS);
    }

    @ApiOperation(value="通告列表（C端）", notes="通告列表（C端）")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "通告列表（C端）", operDesc = "通告列表（C端）")
    @PostMapping("/notice-list")
    public Result<List<ClientNoticeListDTO>> noticeList(){
        return customizedTripScheduleInformation.noticeList();
    }

    @ApiOperation(value="查询地区（C端）", notes="查询地区（C端）")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "查询地区（C端）", operDesc = "查询地区（C端）")
    @GetMapping("/area/{name}")
    public Result<List<ClientAreaDTO>> area(@PathVariable String name){
        return customizedTripScheduleInformation.area(name);
    }

}
